package com.example.util;

import org.apache.shiro.codec.Base64;
import org.apache.shiro.crypto.hash.Md5Hash;

public class CryptographyUtil
{
    private static final String DEFAULT_URL_ENCODING = "UTF-8";//默认编码

    public static String md5(String str, String salt)//加盐加密
    {
        return new Md5Hash(str,salt).toString();
    }

    public static String encodeBase64(String input)//base64加密
    {
        return Base64.encodeToString(input.getBytes());
    }

    public static String decodeBase64(String input)//base64解密
    {
        return Base64.decodeToString(input.getBytes());
    }
}
